package com.ehome.poct.core.pasre.report.text;


import com.ehome.poct.base.api.enums.StripTypeEnums;
import com.ehome.poct.core.pasre.report.text.dto.ReportTextDTO;

import java.math.BigDecimal;

/**
 * @auther: kuiba.peng
 * @date: 2022/11/10 16:01
 * @description: 默认逻辑
 */
public class CRPTextStrategy implements TextStrategy {

    static final BigDecimal CRP_VALUE = BigDecimal.valueOf(10);

    @Override
    public StripTypeEnums getStripType() {
        return StripTypeEnums.CRP;
    }

    @Override
    public String getReportText(ReportTextDTO reportTextDTO) {
        BigDecimal maxValue = reportTextDTO.getMaxValue();
        BigDecimal checkResult = reportTextDTO.getCheckResult();

        //大于10 数据放在常规 后面
        if (checkResult.compareTo(CRP_VALUE) >= 0) {
            if (checkResult.compareTo(maxValue) >= 0) {
                return "常规:≥" + maxValue + reportTextDTO.getSymbol() + "<br/>超敏:≥10.00";
            } else {
                return "常规:" + checkResult + reportTextDTO.getSymbol() + "<br/>超敏:≥10.00";
            }
        }
        //大于参考范围最小值
        return "常规:<10.00<br/>超敏:" + checkResult + reportTextDTO.getSymbol();
    }
}
